package com.ogawa.a7517.bean;

import android.text.TextUtils;

public class MassageArmchair {

    private static MassageArmchair instance;
    private DeviceStateBean deviceStatusBean;
    private int runningStatus;
    private DeviceOffBean deviceOffBean;
    private String fault;

    private MassageArmchair() {

    }

    public static MassageArmchair getInstance() {
        if (instance == null) {
            synchronized (MassageArmchair.class) {
                if (instance == null) {
                    instance = new MassageArmchair();
                }
            }
        }
        return instance;
    }

    public int getReset() {
        if (deviceOffBean == null) {
            return 1;
        }
        return Integer.parseInt(deviceOffBean.getFunctions().getResetSucccessFlag().getModelValue());
    }

    public DeviceOffBean getDeviceOffBean() {
        return deviceOffBean;
    }

    public void setDeviceOffBean(DeviceOffBean deviceOffBean) {
        this.deviceOffBean = deviceOffBean;
    }

    public String getFault() {
        return fault;
    }

    public void setFault(String fault) {
        this.fault = fault;
    }

    public static void setInstance(MassageArmchair instance) {
        MassageArmchair.instance = instance;
    }

    public DeviceStateBean getDeviceStatusBean() {
        return deviceStatusBean;
    }

    public void setDeviceStatusBean(DeviceStateBean deviceStatusBean) {
        this.deviceStatusBean = deviceStatusBean;
    }

    public int getRunningStatus() {
        return runningStatus;
    }

    public void setRunningStatus(int runningStatus) {
        this.runningStatus = runningStatus;
    }

    public boolean isSeniorMassage() {
        if (deviceStatusBean == null) {
            return false;
        }
        DeviceStateBean.FunctionsBean.XyzHandTypeBean xyzHandType = deviceStatusBean.getFunctions().getXyzHandType();
        DeviceStateBean.FunctionsBean.KnockHandTypeBean knockHandType = deviceStatusBean.getFunctions().getKnockHandType();
        DeviceStateBean.FunctionsBean.AirCellShoulderBean airCellShoulder = deviceStatusBean.getFunctions().getAirCellShoulder();
        DeviceStateBean.FunctionsBean.AirCellHandBean airCellHand = deviceStatusBean.getFunctions().getAirCellHand();
        DeviceStateBean.FunctionsBean.AirCellWholebodyBean airCellWhole = deviceStatusBean.getFunctions().getAirCellWholebody();
        DeviceStateBean.FunctionsBean.AirCellWaistBean airCellWaist = deviceStatusBean.getFunctions().getAirCellWaist();
        DeviceStateBean.FunctionsBean.AirCelllegBean airCellLeg = deviceStatusBean.getFunctions().getAirCellleg();
        DeviceStateBean.FunctionsBean.FootWheelButtonBean footRoll = deviceStatusBean.getFunctions().getFootWheelButton();
        DeviceStateBean.FunctionsBean.HandScrollButtonBean handRoll = deviceStatusBean.getFunctions().getHandScrollButton();
        DeviceStateBean.FunctionsBean.HeatBackBean backHeat = deviceStatusBean.getFunctions().getHeatBack();
        DeviceStateBean.FunctionsBean.KneeHeatBean kneeHeat = deviceStatusBean.getFunctions().getKneeHeat();
        DeviceStateBean.FunctionsBean.AutoProgramBean auto = deviceStatusBean.getFunctions().getAutoProgram();
        return Integer.parseInt(auto.getModelValue()) == 0 && (
                Integer.parseInt(xyzHandType.getModelValue()) != 0
                        || Integer.parseInt(knockHandType.getModelValue()) != 0
                        || Integer.parseInt(airCellShoulder.getModelValue()) != 0
                        || Integer.parseInt(airCellHand.getModelValue()) != 0
                        || Integer.parseInt(airCellWhole.getModelValue()) != 0
                        || Integer.parseInt(airCellWaist.getModelValue()) != 0
                        || Integer.parseInt(airCellLeg.getModelValue()) != 0
                        || Integer.parseInt(footRoll.getModelValue()) != 0
                        || Integer.parseInt(handRoll.getModelValue()) != 0
                        || Integer.parseInt(backHeat.getModelValue()) != 0
                        || Integer.parseInt(kneeHeat.getModelValue()) != 0
        );
    }
}
